#include <gtk/gtk.h>

//signal callback
static void button_callback (GtkWidget *widget,
			gpointer data)
{
    g_print ("Hey! You clicked %s mothafucka!\n", (gchar *) data);
}

//event callback
static gboolean delete_event (GtkWidget *widget,
			      GdkEvent  *event,
			      gpointer  data)
{
    gtk_main_quit ();
    return FALSE;
}

int main (int argc, char *argv[])
{
    GtkWidget *window;
    GtkWidget *button;
    GtkWidget *box1;

    gtk_init (&argc, &argv);

    //create a new window, saving it's location to the pointer window
    window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
    
    //set the title of the window to whatever
    gtk_window_set_title (GTK_WINDOW (window), "Hello Buttons!");

    //handler for delete event of the window
    g_signal_connect (G_OBJECT (window), "delete_event",
		      G_CALLBACK (delete_event) , NULL);

    //set window border
    gtk_container_set_border_width (GTK_CONTAINER (window), 10);

    //create a new "box" to pack widgets into
    box1 = gtk_hbox_new (FALSE, 0);

    //put the box into the main window (windows can only hold on thing)
    gtk_container_add (GTK_CONTAINER (window), box1);

    button = gtk_button_new_with_label ("Button 1");
    g_signal_connect (G_OBJECT (button), "clicked",
		      G_CALLBACK (button_callback), (gpointer) "button 1");

    //"pack" this button into box1
    gtk_box_pack_start (GTK_BOX (box1), button, TRUE, TRUE, 0);

    //preparation for button is complete, so we can display it
    gtk_widget_show (button);

    button = gtk_button_new_with_label ("Button 2");
    g_signal_connect (G_OBJECT (button), "clicked",
		      G_CALLBACK (button_callback), (gpointer) "button 2");
    
    gtk_box_pack_start (GTK_BOX (box1), button, TRUE, TRUE, 0);

    gtk_widget_show (button);
    gtk_widget_show (box1);
    gtk_widget_show (window);

    gtk_main ();

    return 0;
}

    		      


    
